package com.syq.controller.advices;

import com.syq.dto.R;
import com.syq.exceptions.BaseException;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Sun Yueqi
 * @version 1.00
 * @time 2022/5/26 10:40
 */
@RestControllerAdvice
public class MyExceptionAdvice {

    public R processBaseException(BaseException exception){
        return R.setResult(exception.getCode(), exception.getMessage(), null);
    }

    public R processBaseException(Exception exception){
        exception.printStackTrace();
        return R.setError();
    }
}
